////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    TigerTreasuresGuts.cpp                                       //
//  Developer:   Tommy Riddle                                                 //
//  Create date: 09/26/2005                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class implementation for the slot gut of the     //
//               Australian Slot machine called Tiger Treasures.              //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2005 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#include "TigerTreasuresGuts.h"

////////////////////////////////////////////////////////////////////////////
/// TigerTreasuresGuts::m_aLineWinSpinResults
///
/// This array is used to quickly get the SpinResult for the number of
/// icons.  It is indexed by wheel icon and then count.  So to get the
/// SpinResult for 5 Jewels, use the following code snippet:
///
///		SpinResult result = m_aLineWinSpinResults[ ICON_JEWELS ][ 5 ];
///
/// In this example result would be set to EVT_FIVE_JEWELS.
////////////////////////////////////////////////////////////////////////////
TigerTreasuresGuts::SpinResult TigerTreasuresGuts::m_aLineWinSpinResults[NUM_VALID_ICONS][6] = 
{
// Number of icons:		  0				1			2					3						4					5
/* ICON_NINE */			{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_THREE_NINE,			EVT_FOUR_NINE,		EVT_FIVE_NINE		},
/* ICON_TEN */			{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_THREE_TEN,			EVT_FOUR_TEN,		EVT_FIVE_TEN		},
/* ICON_JACK */			{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_THREE_JACK,			EVT_FOUR_JACK,		EVT_FIVE_JACK		},
/* ICON_QUEEN */		{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_THREE_QUEEN,		EVT_FOUR_QUEEN,		EVT_FIVE_QUEEN		},
/* ICON_KING */			{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_THREE_KING,			EVT_FOUR_KING,		EVT_FIVE_KING		},
/* ICON_ACE */			{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_THREE_ACE,			EVT_FOUR_ACE,		EVT_FIVE_ACE		},
/* ICON_FLOWER */		{ EVT_LOSER,	EVT_LOSER,	EVT_TWO_FLOWER,		EVT_THREE_FLOWER,		EVT_FOUR_FLOWER,	EVT_FIVE_FLOWER		},
/* ICON_BUTTERFLY */	{ EVT_LOSER,	EVT_LOSER,	EVT_TWO_BUTTERFLY,	EVT_THREE_BUTTERFLY,	EVT_FOUR_BUTTERFLY,	EVT_FIVE_BUTTERFLY	},
/* ICON_PANDA */		{ EVT_LOSER,	EVT_LOSER,	EVT_TWO_PANDA,		EVT_THREE_PANDA,		EVT_FOUR_PANDA,		EVT_FIVE_PANDA		},
/* ICON_JEWELS */		{ EVT_LOSER,	EVT_LOSER,	EVT_TWO_JEWELS,		EVT_THREE_JEWELS,		EVT_FOUR_JEWELS,	EVT_FIVE_JEWELS		},
/* ICON_LOGO */			{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_LOSER,				EVT_LOSER,			EVT_LOSER			},
/* ICON_TIGER*/			{ EVT_LOSER,	EVT_LOSER,	EVT_LOSER,			EVT_LOSER,				EVT_LOSER,			EVT_LOSER			}
};
        
////////////////////////////////////////////////////////////////////////////
/// TigerTreasuresGuts::m_aScatterWinSpinResults
///
/// This array is used to quickly get the SpinResult for the number of
/// icons.  It is indexed by icon count only, since Logos are the only
/// scatter win.  So to get the SpinResult for 5 Logos, use the
/// following code snippet:
///
///		SpinResult result = m_aScatterWinSpinResults[ 5 ];
///
/// In this example result would be set to EVT_FIVE_LOGO.
////////////////////////////////////////////////////////////////////////////
TigerTreasuresGuts::SpinResult TigerTreasuresGuts::m_aScatterWinSpinResults[6] = 
{
	// ICON_LOGO			   Number of Icons
	EVT_LOSER,				// 0
	EVT_SCATTER_NEAR_MISS,	// 1
	EVT_TWO_LOGO,			// 2
	EVT_THREE_LOGO,			// 3
	EVT_FOUR_LOGO,			// 4
	EVT_FIVE_LOGO			// 5
};

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::TigerTreasuresGuts()   
///
/// This is the default constructor for the class.
////////////////////////////////////////////////////////////////////////////
TigerTreasuresGuts::TigerTreasuresGuts()
{
	// If this doesn't compile it means that someone probably added
	// another icon type but did not update the
	// m_aLineWinSpinResults array. 
	C_ASSERT( countof( m_aLineWinSpinResults ) == NUM_VALID_ICONS );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::~TigerTreasuresGuts()
///
/// Destructor for TigerTreasuresGuts. 
////////////////////////////////////////////////////////////////////////////
TigerTreasuresGuts::~TigerTreasuresGuts()
{
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::SpinResult TigerTreasuresGuts::getLineWinResultWithPossibleSubstitution(	uint8* stops, uint8 testIcon, int nDirection, bool& bTigerSubstitution ) const
///
/// @param   stops					The array of stop positions for the line.
/// @param   et						The direction that we should use when we evaluate the line.
/// @param   bTigerSubstitution		An output parameter that is set if a subsitution is used.
///
/// @return	 SpinResult				A payout from the SpinResult enumeration.
///
/// This helper method is used to calculate the line win payout with a possible substitution.
////////////////////////////////////////////////////////////////////////////
TigerTreasuresGuts::SpinResult TigerTreasuresGuts::getLineWinResultWithPossibleSubstitution(
	uint8* stops, EvalType et, bool& bTigerSubstitution ) const
{
	// Initialize the out parameter
	bTigerSubstitution = false;

	// Keep up with the direction we are going.
	int nDirection;

	// We need a place to keep up with the starting reel since we can go
	// in either direction.
	int nStartReel;

	// If we are going from left to right...
	if ( et == etLeftToRight )
	{
		// then start at reel 0.
		nStartReel = 0;

		// We will need to increment the reel as we iterate through the loop.
		nDirection = 1;
	}
	else
	{
		// Otherwise we must be going from right to left.
		ASSERT( et == etRightToLeft );

		// Start on the last reel.
		nStartReel = getReelCount() - 1;

		// We will need to decrement the reel as we iterate through the loop.
		nDirection = -1;
	}

	// The icon we are testing for.
	uint8 testIcon = getIcon( getGameModeId(), nStartReel, stops[ nStartReel ] )->iconid;

	// Loop through the remaining reels until the streak is over
	for ( int i = 1; i < getReelCount(); i++ )
    {
		// Figure out what our current reel is for this iteration.
		int nCurrentReel = nStartReel + ( i * nDirection );

		// See what this icon is.
		uint8 currentIcon = getIcon( getGameModeId(), nCurrentReel, stops[ nCurrentReel ] )->iconid;

		// If the current icon is a Tiger...
		if ( currentIcon == ICON_TIGER )
		{
			// then use it as a substitution symbol and continue on.
			bTigerSubstitution = true;
			continue;
		}
		// Otherwise if the test icon is a Tiger...
		else if ( testIcon == ICON_TIGER )
		{
			// then we still have a Tiger substitution.  In this case the line
			// started out with a Tiger.
			bTigerSubstitution = true;

			// We have now found our first icon that is not a Tiger.  All
			// of the rest of the icons will have to match this one now for the
			// streak to continue, so change our test icon.
			testIcon = currentIcon;
			continue;
		}

		// If the current icon is not the test icon...
        if ( currentIcon != testIcon )
        {
			// then the streak is over so break out of the loop
			break;
        }
    }

	// Use the array to look up the spin result for i testIcons.
	return lookupLineWinSpinResult( testIcon, i );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 bool TigerTreasuresGuts::doesRightToLeftLineWinPayMore( SpinResult srLeftToRight, bool bLeftToRightTigerSubstitution, SpinResult srRightToLeft ) const;
///
/// @param   srLeftToRight	The spin result to calculate the left to right payout for.
/// @param   srRightToLeft	The spin result to calculate the right to left payout for.
///
/// @return	 bool			True if the right to left win is larger.
///
/// This helper method is used to see which payout is larger.
////////////////////////////////////////////////////////////////////////////
bool TigerTreasuresGuts::doesRightToLeftLineWinPayMore( SpinResult srLeftToRight, bool bLeftToRightTigerSubstitution,
	SpinResult srRightToLeft, bool bRightToLeftTigerSubstitution ) const
{
	// Lookup the payout for the left to right line win.
	long nLeftToRightLineWinPayout = getPayout( srLeftToRight )->payoutAmount;

	// If we had a left to right substitution...
	if ( bLeftToRightTigerSubstitution )
	{
		// then factor in the multiplier.
		nLeftToRightLineWinPayout *= MULTIPLIER_TIGER_SUBSTITUTION;
	}

	// Lookup the payout for the right to left line win.
	long nRightToLeftLineWinPayout = getPayout( srRightToLeft )->payoutAmount;

	// If we had a right to left substitution...
	if ( bRightToLeftTigerSubstitution )
	{
		// then factor in the multiplier.
		nRightToLeftLineWinPayout *= MULTIPLIER_TIGER_SUBSTITUTION;
	}

	// If the payout is the same for both directions...
	if ( nRightToLeftLineWinPayout == nLeftToRightLineWinPayout )
	{
		// then return true if the right to left spin result is higher.
		return ( srRightToLeft > srLeftToRight );
	}

	// Return true if the right to left payout is bigger.
    return ( nRightToLeftLineWinPayout > nLeftToRightLineWinPayout );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::classifyStops()   
///
/// @param   stops      The array of stop positions for the line.
/// @param   bet        The value of the line bet.
/// @param   line       The index of the line.
///
/// @return	 uint8      A payout from the SpinResult enumeration as a uint8.    
///
/// This helper method is used to calculate the payout on a line.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
	uint8& rtnresult, uint8& multiplier )
{
	// Keep up with whether or not we have a substitution on the rtnresult.
	bool bSubstitution = false;

	// See what the payout is going left to right.
	// Declare a local variable to track whether or not we found a Tiger substitution.
	bool bLeftToRightTigerSubstitution = false;

	// See what the spin result is if we used any Tigers as substitution symbols.
	SpinResult srLeftToRightResult = getLineWinResultWithPossibleSubstitution( stops,
		etLeftToRight, bLeftToRightTigerSubstitution );

	// Now see what the payout is going right to left.
	// Declare a local variable to track whether or not we found a Tiger substitution.
	bool bRightToLeftTigerSubstitution = false;

	// See what the spin result is if we used any Tigers as substitution symbols.
	SpinResult srRightToLeftResult = getLineWinResultWithPossibleSubstitution( stops,
		etRightToLeft, bRightToLeftTigerSubstitution );

	// Use the larger payout between the two.
    if ( doesRightToLeftLineWinPayMore( srLeftToRightResult, bLeftToRightTigerSubstitution,
		srRightToLeftResult, bRightToLeftTigerSubstitution ) )
	{
		// The right to left win pays more.
		rtnresult = srRightToLeftResult;

		// Use the right to left substitution flag.
		bSubstitution = bRightToLeftTigerSubstitution;

		// Set the right to left line win flag to make things easier for the client.
		setRightToLeftLineWin( line );
	}
	else
	{
		// Otherwise the left to right win pays more.
		rtnresult = srLeftToRightResult;

		// Use the left to right substitution flag.
		bSubstitution = bLeftToRightTigerSubstitution;
	}

	// If we did actually have a substitution and a winning spin...
	if ( bSubstitution && rtnresult != EVT_LOSER )
	{
		// then add a note and change the multiplier.
		spinline->addNote( NOTE_TIGER_SUBSTITUTION );
		multiplier = MULTIPLIER_TIGER_SUBSTITUTION;
	}
}

////////////////////////////////////////////////////////////////////////////
/// @fn		TigerTreasuresGuts::tryForJackpot()
///
///	This function tries to win the jackpot and adds the scatter if we hit
/// the jackpot.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::tryForJackpot( SlotSpin* spin )
{
	// If we are in the first paid spin (NOT a bonus spin)...
	if ( getGameModeId() == MODE_NORMAL ) 
	{
		// then try for the Random Progressive Jackpot
		// If we hit the jackpot...
		if ( getRandomProgressiveJackpotResult( spin->getSpinLineCount() ) || 
			m_bForceRandomJackpot==true)

		{
			// then add a jackpot scatter to the spin.
			spin->addScatter( 0,
				getPayout( EVT_RANDOM_PROGRESSIVE_WINNER )->payoutAmount, 1,
				true, EVT_RANDOM_PROGRESSIVE_WINNER, 0 );
		}
    }
}

////////////////////////////////////////////////////////////////////////////
/// @fn		TigerTreasuresGuts::getScatterWinResult()
///
/// @param   spin				The spin we are evaluating.
/// @param   et					The direction that we should use when we evaluate the scatter.
/// @param   scatterPositions	An output parameter that contains a bit mask for the icon positions.
///
/// @return	 SpinResult			A payout from the SpinResult enumeration.
///
///	This function looks for scatter wins.  This game supports "left to right"
/// and "right to left".
////////////////////////////////////////////////////////////////////////////
TigerTreasuresGuts::SpinResult TigerTreasuresGuts::getScatterWinResult( SlotSpin* spin, EvalType et, int32& scatterPositions ) const
{
	// Keep up with how many scatter icons we found.
	uint8 numLogoIcons = 0;

	// Keep up with the direction we are going.
	int nDirection;

	// We need a place to keep up with the starting reel since we can go
	// in either direction.
	int nStartReel;

	// If we are going from left to right...
	if ( et == etLeftToRight )
	{
		// then start at reel 0.
		nStartReel = 0;

		// We will need to increment the reel as we iterate through the loop.
		nDirection = 1;
	}
	else
	{
		// Otherwise we must be going from right to left.
		ASSERT( et == etRightToLeft );

		// Start on the last reel.
		nStartReel = getReelCount() - 1;

		// We will need to decrement the reel as we iterate through the loop.
		nDirection = -1;
	}

	// Loop through each reel.
  	for( int i = 0; i < getReelCount(); i++ )
	{
		// Figure out what our current reel is for this iteration.
		int reel = nStartReel + ( i * nDirection );

		// The position bit for the current icon in case it needs to be stored in a mask.
		uint8 position = reel;

		// Keep up with whether or not we found a scatter icon on this reel.
		bool bFoundLogoOnReel = false;

		// Loop through each row in the wheel house.
		for( int row = 0; row < 3; row++ )
		{
			// Get the current stop.
			uint8 stop = relativeWheelPosition( getGameModeId(), reel,
				spin->getStops()[ reel ], row );

			// Get the icon for the current stop.
			uint8 currentIcon = getIcon( getGameModeId(), reel, stop )->iconid;
			
			// If the icon is a Logo...
			if ( currentIcon == ICON_LOGO )
			{
				// then increase the Logo count
				numLogoIcons++;

				// Set the bit in the position mask for this stop.
				scatterPositions |= 1 << position;

				// Set the flag so that we know we found a scatter icon on this reel.
				bFoundLogoOnReel = true;
			}

			// Move to the next bit in the position mask.
            position += 5;
		}

		// If we didn't find a Logo on the reel...
		if (! bFoundLogoOnReel )
		{
			//psharpless 11/28/06 - Case:14418
			//if we are doing an RTL check and reel4 had a scatter
			//but reel3 did not, we need to do a special check on reel2
			if(et == etRightToLeft && reel == 3 && numLogoIcons == 1)
			{
				//if reel2 has a scatter we need to add it to the
				//scatter positions mask

				position = 2;

				// Loop through each row in the wheel house.
				for( int row = 0; row < 3; row++ )
				{
					// Get the current stop.
					uint8 stop = relativeWheelPosition( getGameModeId(), 2,
						spin->getStops()[ 2 ], row );

					// Get the icon for the current stop.
					uint8 currentIcon = getIcon( getGameModeId(), 2, stop )->iconid;
					
					// If the icon is a Logo...
					if ( currentIcon == ICON_LOGO )
					{
						// Set the bit in the position mask for this stop.
						scatterPositions |= 1 << position;
					}

					// Move to the next bit in the position mask.
					position += 5;
				}
			}

			// then we are done.
			break;
		}
	}

	// Use the array to look up the spin result.
	return lookupScatterWinSpinResult( numLogoIcons );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::evaluateScatterWin()
///
/// This function determines if the current spin wins a scatter payment and
/// adds the scatter.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::evaluateScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions )
{
	// If we got the scatter win (or almost got it)
	if ( srScatterResult != EVT_LOSER )
	{
		// Get the base payout for the scatter.
		int32 nPayout = getPayout( srScatterResult )->payoutAmount;
		
		// Scatters payout based on the total bet, so factor in the number of bet lines.
		nPayout *= spin->getSpinLineCount();

		// Add the payout to the total win for this spin.
		increaseTotalWin( nPayout );
    
		// Add a scatter to the spin.
		spin->addScatter( scatterPositions,
			nPayout * getBetPerLine(), 1, false, srScatterResult, 0 );
	}
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::evaluateFeatureTrigger()
///
/// This function determines if the feature was triggered.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::evaluateFeatureTrigger( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions )
{
	// We need a spin result for the feature trigger.
	SpinResult srFeatureTrigger;

	// We need a place to keep up with how many free spins to award.
	int32 nFreeSpins = 0;

	// If the scatter result was a loser...
	if ( srScatterResult == EVT_LOSER )
	{
		// then we are done so just return now.
		return;
	}
	// Otherwise if the scatter result was a near miss or 2 Logo...
	else if ( srScatterResult == EVT_SCATTER_NEAR_MISS ||
		srScatterResult == EVT_TWO_LOGO )
	{
		// then we will have a near miss for the feature.
		srFeatureTrigger = EVT_FEATURE_NEAR_MISS;
	}
	// Otherwise...
	else
	{
		// we hit the free game feature.
		srFeatureTrigger = EVT_FREE_GAME_FEATURE;

		// Make sure that we really did have the correct scatter icons.
		ASSERT( srScatterResult == EVT_THREE_LOGO || 
			srScatterResult == EVT_FOUR_LOGO ||
			srScatterResult == EVT_FIVE_LOGO );

		// See how many free spins they get.
		nFreeSpins = getRandomValueFromProbabilityTable();

		// Add the free spins.
		incrementFreeSpins( nFreeSpins );

		// Change the game mode.
		setGameModeId( MODE_FREE_SPIN );
	}

	// Add a scatter to the spin for the near miss or the feature trigger.
	spin->addScatter( scatterPositions, 0, 0, false,
		srFeatureTrigger, nFreeSpins );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::classifyScatters( SlotSpin* spin )
///
/// @param   spin       Pointer to the spin with stop data.
///
/// This is an override of the framework method.  
/// It determines if the current spin merits free spins or scatter payments.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::classifyScatters( SlotSpin* spin )
{	
	// Try for the Random Progressive Jackpot
	tryForJackpot( spin );

	// See what the payout is going left to right.
	// Declare a local variable to track the scatter positions.
	int32 nLeftToRightScatterPositions = 0;

	// See what the spin result is going left to right.
	SpinResult srLeftToRightResult = getScatterWinResult( spin,
		etLeftToRight, nLeftToRightScatterPositions );

	// Now see what the payout is going right to left.
	// Declare a local variable to track the scatter positions.
	int32 nRightToLeftScatterPositions = 0;

	// See what the spin result is going right to left.
	SpinResult srRightToLeftResult = getScatterWinResult( spin,
		etRightToLeft, nRightToLeftScatterPositions );

	// Scatters payout left to right and right to left.
	evaluateScatterWin( spin, srLeftToRightResult, nLeftToRightScatterPositions );

	// If the left to right result was not five logo...
	if ( srLeftToRightResult != EVT_FIVE_LOGO )
	{
		// then also give them the right to left scatter.
		evaluateScatterWin( spin, srRightToLeftResult, nRightToLeftScatterPositions );
	}

	// Now see if they triggered the feature.
	evaluateFeatureTrigger( spin, srLeftToRightResult, nLeftToRightScatterPositions );

	// If the left to right result was not five logo...
	if ( srLeftToRightResult != EVT_FIVE_LOGO )
	{
		// then also check the right to left result.
		// Special case code for when there is a scatter icon on reel 2, but not reel 4.
		if ( srRightToLeftResult == EVT_LOSER )
		{
			// Keep up with whether or not we found a scatter icon on this reel.
			bool bFoundLogoOnReel2 = false;

			// Look at reel 2 and 3.
  			for( int reel = 2; reel <= 3; reel++ )
			{
				// The position bit for the current icon in case it needs to be stored in a mask.
				uint8 position = reel;

				// Loop through each row in the wheel house.
				for( int row = 0; row < 3; row++ )
				{
					// Get the current stop.
					uint8 stop = relativeWheelPosition( getGameModeId(), reel,
						spin->getStops()[ reel ], row );

					// Get the icon for the current stop.
					uint8 currentIcon = getIcon( getGameModeId(), reel, stop )->iconid;
					
					// If the icon is a Logo...
					if ( currentIcon == ICON_LOGO )
					{
						// Set the bit in the position mask for this stop.
						nRightToLeftScatterPositions |= 1 << position;

						// If we are on reel 2...
						if ( reel == 2 )
						{
							// then set the flag so that we know we found a scatter icon on this reel.
							bFoundLogoOnReel2 = true;
						}
					}

					// Move to the next bit in the position mask.
					position += 5;
				}
			}

			// If we found a logo on reel 2...
			if ( bFoundLogoOnReel2 )
			{
				// then force a feature near miss.
				srRightToLeftResult = EVT_SCATTER_NEAR_MISS;
			}
		}

		// Check to see if the right to left scatter triggered the feature.
		evaluateFeatureTrigger( spin, srRightToLeftResult, nRightToLeftScatterPositions );
	}
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::setRightToLeftLineWin()
///
/// This function sets the right to left line win flag for the passed in
/// line.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::setRightToLeftLineWin( uint8 nLine )
{
	// Get the current flags.
	int32 n = m_subGame->getData( SGDIDX_RIGHT_TO_LEFT_LINE_WINS );

	// Turn on the flag for the new line.
	n |= 1 << nLine;

	// Store the new flags in the sub-game data.
    m_subGame->update( SGDIDX_RIGHT_TO_LEFT_LINE_WINS, n );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::resetRightToLeftLineWins()
///
/// This function resets all of the right to left line win flags in
/// preparation for a new spin.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::resetRightToLeftLineWins()
{
	// Just set the sub-game data back to zero.
    m_subGame->update( SGDIDX_RIGHT_TO_LEFT_LINE_WINS, 0 );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::isValidGuts()   
///
/// @return	 bool8      True if gut is valid.    
///
/// This helper method is used to see if the current gut ID is valid.
////////////////////////////////////////////////////////////////////////////
bool8 TigerTreasuresGuts::isValidGuts()
{
	// Make sure that the m_aLineWinSpinResults array has an entry for each reel,
	// and an additional entry in case there are 0 icons on the line.
	// Note:  we can't do this in the constructor because we have to call
	// getReelCount.
	ASSERT( countof( m_aLineWinSpinResults[0] ) == getReelCount( MODE_NORMAL ) + 1 );

	// Make sure that the m_aScatterWinSpinResults array has an entry for each reel,
	// and an additional entry in case there are 0 scatter icons.
	ASSERT( countof( m_aScatterWinSpinResults ) == getReelCount( MODE_NORMAL ) + 1 );

	// Now make sure that both game modes have the same number of reels.
	ASSERT( getReelCount( MODE_NORMAL ) == getReelCount( MODE_FREE_SPIN ) );

	// Finally just check to see if the gut is within the right range.
    return ( getGutsId() >= 1200 && getGutsId() < 1300 );
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::preSpinClassifyResults( SlotSpin* spin )
///
/// @param   spin       Pointer to the spin with stop data.
///
/// This method is overridden to alter the reel stops for the respin feature.
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::preSpinClassifyResults( SlotSpin* spin )
{
	SlotGuts::preSpinClassifyResults(spin);

	// Reset all of the right to left line win flags.
	resetRightToLeftLineWins();
}

////////////////////////////////////////////////////////////////////////////
/// @fn 	 TigerTreasuresGuts::Debug_SetLoserStops( uint8* pStops )
///
/// @param   pStops		The stops to set.
///
/// Base class override, returns a losing spin triggered by the debug tool
////////////////////////////////////////////////////////////////////////////
void TigerTreasuresGuts::Debug_SetLoserStops( uint8* pStops )
{
	pStops[0]=0;
	pStops[1]=0;
	pStops[2]=3;
	pStops[3]=0;
	pStops[4]=0;
}